/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.evote.monitoreo.entity;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author Mendoza
 */
@Entity
@Table(name = "escrutinio", catalog = "evote", schema = "")
@NamedQueries({
    @NamedQuery(name = "Escrutinio.findAll", query = "SELECT e FROM Escrutinio e"),
    @NamedQuery(name = "Escrutinio.findByIdEscrutinio", query = "SELECT e FROM Escrutinio e WHERE e.idEscrutinio = :idEscrutinio"),
    @NamedQuery(name = "Escrutinio.findByNumeroVotos", query = "SELECT e FROM Escrutinio e WHERE e.numeroVotos = :numeroVotos")})
public class Escrutinio implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "idEscrutinio", nullable = false)
    private Integer idEscrutinio;
    @Column(name = "numeroVotos")
    private Integer numeroVotos;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "escrutinioidEscrutinio")
    private List<Locacion> locacionList;
    @JoinColumn(name = "Opcion_idOpcion", referencedColumnName = "idOpcion", nullable = false)
    @ManyToOne(optional = false)
    private Opcion opcionidOpcion;

    public Escrutinio() {
    }

    public Escrutinio(Integer idEscrutinio) {
        this.idEscrutinio = idEscrutinio;
    }

    public Integer getIdEscrutinio() {
        return idEscrutinio;
    }

    public void setIdEscrutinio(Integer idEscrutinio) {
        this.idEscrutinio = idEscrutinio;
    }

    public Integer getNumeroVotos() {
        return numeroVotos;
    }

    public void setNumeroVotos(Integer numeroVotos) {
        this.numeroVotos = numeroVotos;
    }

    public List<Locacion> getLocacionList() {
        return locacionList;
    }

    public void setLocacionList(List<Locacion> locacionList) {
        this.locacionList = locacionList;
    }

    public Opcion getOpcionidOpcion() {
        return opcionidOpcion;
    }

    public void setOpcionidOpcion(Opcion opcionidOpcion) {
        this.opcionidOpcion = opcionidOpcion;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idEscrutinio != null ? idEscrutinio.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Escrutinio)) {
            return false;
        }
        Escrutinio other = (Escrutinio) object;
        if ((this.idEscrutinio == null && other.idEscrutinio != null) || (this.idEscrutinio != null && !this.idEscrutinio.equals(other.idEscrutinio))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.evote.monitoreo.entity.Escrutinio[idEscrutinio=" + idEscrutinio + "]";
    }

}
